package com.msb.singleton;

/**
 * @Auther： WangLei
 * @Date： 2021/9/12-09-12-22:53
 * @Description: com.msb.singleton
 * @version: 1.0
 */
public class InnerClass {
    private InnerClass(){}

    private static class InClass{
        private static final InnerClass instance = new InnerClass();
    }

    public static InnerClass getInstance() {
        return InClass.instance;
    }

    public static void main(String[] args) {
        for(int i=0;i<100;i++){
            new Thread(()->{
                InnerClass.getInstance().show(5);
                System.out.println(InnerClass.getInstance().hashCode());
            }).start();
        }
    }

    int age =10;
    public void show(int a){
        int x =2;

        class InClass {
            public void InPrint() {
                System.out.println(a);
                System.out.println(age);
            }
        }
        new InClass().InPrint();
    }



}
